﻿using Mt.Site.Core.ContentManagement.Entities;
using Mt.Site.Core.ContentManagement.Values;
using Mt.Site.Core.Synchronization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Mt.Site.Core.ContentManagement
{
    public interface IContentManager
    {
        Task<Dictionary<string, object>> GetContentForEdit(Guid? id, long menuId, string customKey, Guid? relateId);

        Task<PagedContent<Dictionary<string, object>>> GetContentListByPagedAsync(
            Func<IQueryable<Content>, IQueryable<Content>> queryMethod,
            int skipCount,
            int getCount,
            string customKey, long menuId, Guid? relateId);

        Task<Guid> CreateAsync(Dictionary<string, string> values, long menuId, string customKey, Guid? relateId);

        Task<Guid> UpdateAsync(Dictionary<string, string> values, Guid contentId, long menuId, string customKey, Guid? relateId);

        Task<ContentConfig> GetConfig(string customKey, long menuId);
        Task<string> GetCustomKey(string customKey, long menuId);

        #region 仅Content表

        Task<IdAndMenuId> DeleteAysnc(Guid id);

        Task<List<IdAndMenuId>> DeleteListAysnc(IList<Guid> idList);

        Task<List<IdAndMenuId>> SetStatus(IList<Guid> idList, bool isActive);

        Task<List<IdAndMenuId>> SwapObjectSortAsync(List<Guid> idList, List<int> orderList);

        Task<IdAndMenuId> SetNewOrderNumberAsync(Guid id, int order);

        #endregion

        List<string> GetSpecialFields();

        Task RecoverContentAsync(List<Guid> idList);
    }
}
